from ChessBoard import *
import time

#plays a game of chess, which it reads from a file.

def playGameFromFile(f):
    chessboard = ChessBoard()
    chessboard.resetBoard()
    moves = []
    print "Loading moves..."

    for line in f:
        moves.extend((line.rstrip()).split(" "))
    print "Moves loaded"

    i = 0
    for move in moves:
        print "Move number: ", i
        i += 1
        chessboard.printBoard()
        print chessboard.addTextMove(move)
        time.sleep(0.1)

    chessboard.printBoard()
    chessboard.printBoardSingleRow()


f = open('moves.txt', 'r')
playGameFromFile(f)

print "---- GAME 2 ------"

f = open('moves2.txt', 'r')
playGameFromFile(f)

